import os
from configparser import ConfigParser
from utils.handle_path import configs_path

# 读取配置文件【cfg conf ini】文件
class Config(ConfigParser):
    """在创建对象时，直接在家配置文件中的内容（多封装了一层）"""

    def __init__(self, conf_file):
        super().__init__()
        self.read(conf_file, encoding='utf-8')


conf = Config(os.path.join(configs_path, 'config.ini'))

if __name__ == '__main__':
    # conf = ConfigParser()
    # conf.read(r"D:\LiuJiang\PyCharmProject\lemon\py35\conf\config.ini",encoding='utf-8')
    format = conf.get('log', 'format')
    print(format)
    name = conf.get('logging', 'name')
    # level = conf.get('logging', 'level')
    # filename = conf.get('logging', 'filename')
    # sh_level = conf.get('logging', 'sh_level')
    # fh_level = conf.get('logging', 'fh_level')
    print(name)
    # print(level)
    # print(filename)
    # print(sh_level)
    # print(fh_level)
